import { BinaryDecision } from "framework/FSM/DecisionTree/Decision";
import { DecisionTreeNode } from "framework/FSM/DecisionTree/DecisionTreeNode";
 
export class DecisionFactoryActive <T extends IStateArg<Room >> extends BinaryDecision<T>
{


    public testValue(arg:T): boolean
    {
        const memory = arg.entity.getNodeMemory();
        
        if((arg.entity.controller?.level as number)>=7 && arg.entity.getEntity("CoreEntity").Factory &&memory.Tasks["factory"] && memory.Tasks["factory"] .length>0 )
        {
            const transportk = (memory.Tasks["factory"][0] as ITaskDeclare["factory"]).data.arg.transportKey;
            // if(memory.Tasks["factory"][0].pause)
            // {
            //     return false;
            // }
            if(transportk && arg.entity.findTaskById(transportk,"core"))
            {
                return false;
            }
            return true
        }
        return false;
    }

    value: any;


    public setValue(val: any)
    {
        this.value = val;
    }
}

